package org.edu.modules.jxzy.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.edu.modules.jxzy.entity.JwJiaocai;
import org.edu.modules.jxzy.mapper.JwJiaocaiMapper;
import org.edu.modules.jxzy.service.IJwJiaocaiService;
import org.edu.modules.scheduleCommon.dto.BasePageDto;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 教材信息表
 * @Author: jeecg-boot
 * @Date:   2021-04-14
 * @Version: V1.0
 */
@Service
public class JwJiaocaiServiceImpl extends ServiceImpl<JwJiaocaiMapper, JwJiaocai> implements IJwJiaocaiService {

    @Override
    public IPage<JwJiaocai> pageDto(BasePageDto page, Wrapper queryWrapper) {
        return baseMapper.pageDto(page, queryWrapper);

    }

    @Override
    public IPage<JwJiaocai> listByPage(IPage<JwJiaocai> page, Wrapper<JwJiaocai> wrapper) {
        return baseMapper.listByPage(page,wrapper);
    }

    @Override
    public List<JwJiaocai> listByDMorMC(String dm, String mc) {
        if(dm!=null&&mc==null){
            return baseMapper.selectList(new QueryWrapper<JwJiaocai>()
                    .eq("JCDM",dm));
        }else if(dm==null&&mc!=null){
            return baseMapper.selectList(new QueryWrapper<JwJiaocai>()
                    .eq("JCMC",mc));
        }else if(dm!=null&&mc!=null){
            return baseMapper.selectList(new QueryWrapper<JwJiaocai>()
                    .eq("JCMC",mc).eq("JCDM",dm));
        }
        return null;
    }
}
